Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle crashing tweaks #288

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

Doubleumc
Copy link
Contributor

@Doubleumc Doubleumc commented Jun 8, 2024

About the pull request

Corrects a few math issues and loosens tolerances so vehicle-crash-interior-flinging can actually happen now.

move_momentum can be positive for forward or negative for backward, so Floor(move_momentum/2) made forward crashes less intense and backward crashes more intense. Corrected to trunc(move_momentum/2), which rounds towards zero consistently.

The maximum value for move_momentum, fittingly named move_max_momentum, is 2 for the APC and 3 for the tank. Because its divided by 2 and then floored, the max momentum actually fed to the interior_crash_effect() proc was 1* (3/2 = 1.5, floor(1.5) = 1). interior_crash_effect() has an early return for if(abs(move_momentum) <= 1). Corrected to if(abs(move_momentum) < 1) so values of 1 still trigger the crash.

*except the tank moving backwards, (-3/2 = -1.5, floor(-1.5) = -2)

Correctly uses the magnitude of move_momentum in places where a negative number would cause inconsistent results, like fling_distance and camera shake strength.

Explain why it's good for the game

The code was there, implemented, called, but never actually fulfilled its own conditions -- except for the tank driving backwards at full speed, which can't be the only intended use.

If crashing wasn't desired, it would be better to remove it completely rather than leaving it in its bugged state.

Testing Photographs and Procedure

Boots without issue. Crashing visual and fling effects now work for both forward and backward collisions.

Changelog

🆑
fix: vehicle crashes more consistently fling loose contents
/:cl:

@github-actions github-actions bot added the fix label Jun 8, 2024
@AndroBetel
Copy link
Contributor

will test merge for some time and then probably merge

@AndroBetel AndroBetel merged commit e664bb2 into cmss13-devs:master Jul 8, 2024
36 checks passed
@Doubleumc Doubleumc deleted the vehicle-crashing-tweaks branch July 8, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants